package net.anzhuo.common.utils;

import java.util.ArrayList;
import java.util.List;

import net.anzhuo.entity.es.Result;

public class PageUtils {
	
	public int pageSize=15;
	public int pageIndex=1;
	public int pageTotalSize=0;
	
	public int start=0;
	public int end=0;
	public List<Result> result=new ArrayList<Result>();
	public PageUtils(List<Result> list,int pageIndex,int pageSize)
	{
		result=new ArrayList<Result>();
	  pageTotalSize=((list.size()-1)/pageSize+1);	
	  this.pageIndex=pageIndex;
	  this.pageSize=pageSize;
	  start=((this.pageIndex-1)*pageSize);
	  end=(this.pageIndex*pageSize-1)<(list.size()-1)?(this.pageIndex*pageSize-1):(list.size()-1);
	  for(int i=start;i<=end;i++)
	  {
		  result.add(list.get(i));
	  }
	  
	}

}
